#!/bin/bash

set -e

test-retry ham4db-client -c stop-replica -i 127.0.0.1:10113
test-retry ham4db-client -c stop-replica -i 127.0.0.1:10114
ham4db-client -c register-candidate -i 127.0.0.1:10112 --promotion-rule must_not
mysql -uci -pci -h 127.0.0.1 --port=10111 -e "update test.heartbeat set hint='mysql-failover-lost-replicas'"
sleep 2

mysqladmin -uci -pci -h 127.0.0.1 --port=10111 shutdown
sleep 20
